<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" >

  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/turbolinks/5.2.0/turbolinks.js" integrity="sha256-iM4Yzi/zLj/IshPWMC1IluRxTtRjMqjPGd97TZ9yYpU=" crossorigin="anonymous"></script>
  <link href="https://fonts.googleapis.com/css?family=Roboto+Mono" rel="stylesheet">
  <link href="https://fonts.googleapis.com/css?family=Cousine|Inconsolata" rel="stylesheet">
  <link rel="shortcut icon" type="image/png" href="/favicon.png">

  <link rel="stylesheet" href="/css/style.css">
  <link rel="stylesheet" href="/css/css/fontawesome-all.min.css">
  <link rel="stylesheet" href="/css/css/work-sans-v7.css">
  <script src="/js/main.js"></script>

  <!-- Begin Jekyll SEO tag v2.6.1 -->
<title>PY: Get Posts | Hive Developer</title>
<meta name="generator" content="Jekyll v4.0.0" />
<meta property="og:title" content="PY: Get Posts" />
<meta property="og:locale" content="en_US" />
<meta name="description" content="Tutorial pulls a list of the posts from the blockchain with selected filter and tag then displays output." />
<meta property="og:description" content="Tutorial pulls a list of the posts from the blockchain with selected filter and tag then displays output." />
<link rel="canonical" href="get_posts.html" />
<meta property="og:url" content="get_posts.html" />
<meta property="og:site_name" content="Hive Developer" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2020-08-26T11:52:22-07:00" />
<script type="application/ld+json">
{"description":"Tutorial pulls a list of the posts from the blockchain with selected filter and tag then displays output.","mainEntityOfPage":{"@type":"WebPage","@id":"get_posts.html"},"@type":"BlogPosting","url":"get_posts.html","headline":"PY: Get Posts","dateModified":"2020-08-26T11:52:22-07:00","datePublished":"2020-08-26T11:52:22-07:00","@context":"https://schema.org"}</script>
<!-- End Jekyll SEO tag -->


  
</head>
<body>
<header>
  <h1>
    <button type="button" class="open-nav" id="open-nav"></button>
    <a href="/"  class="logo-link"><img src="/images/logotype_black.svg" height="40" alt="Hive Developer logo"></a>
  </h1>

  
  <form action="/search/" method="get">
    <input type="text" name="q" id="search-input" placeholder="Search">
    <input type="submit" value="Search" style="display: none;">
  </form>
  

  <div id="sidebar" class="sidebar">
	
	
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/">
		<h6 class="ctrl-nav-section title">Introduction</h6>
		<ul class="cont-nav-section content">
			
				
					
					
						
						<li><a href="/#introduction-welcome">Welcome to Hive</a></li>
						
					
				
			
		</ul>
	</section>
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/quickstart/">
		<h6 class="ctrl-nav-section title">Quickstart</h6>
		<ul class="cont-nav-section content">
			
				
					
					
						
						<li><a href="/quickstart/#quickstart-choose-library">Choose Library</a></li>
						
					
						
						<li><a href="/quickstart/#quickstart-hive-full-nodes">Hive Nodes</a></li>
						
					
						
						<li><a href="/quickstart/#quickstart-testnet">Hive Testnet</a></li>
						
					
				
			
		</ul>
	</section>
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/tutorials/">
		<h6 class="ctrl-nav-section title">Tutorials</h6>
		<ul class="cont-nav-section content">
			
				
					
						<li><a href="/tutorials/#tutorials-javascript">Javascript</a></li>
					
				
					
						<li><a href="/tutorials/#tutorials-python">Python</a></li>
					
				
					
						<li><a href="/tutorials/#tutorials-ruby">Ruby</a></li>
					
				
					
						<li><a href="/tutorials/#tutorials-recipes">Recipes</a></li>
					
				
			
		</ul>
	</section>
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/services/">
		<h6 class="ctrl-nav-section title">Services</h6>
		<ul class="cont-nav-section content">
			
				
					
					
						
						<li><a href="/services/#services-hive-blog">hive.blog</a></li>
						
					
						
						<li><a href="/services/#services-hivesigner">HiveSigner</a></li>
						
					
						
						<li><a href="/services/#services-jussi">Jussi</a></li>
						
					
						
						<li><a href="/services/#services-imagehoster">ImageHoster</a></li>
						
					
						
						<li><a href="/services/#services-dhf">DHF</a></li>
						
					
				
			
		</ul>
	</section>
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/apidefinitions/">
		<h6 class="ctrl-nav-section title">Appbase API</h6>
		<ul class="cont-nav-section content">
			
				
					
					
						
						<li><a href="/apidefinitions/#apidefinitions-condenser-api">Condenser Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-bridge">Bridge</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-account-by-key-api">Account By Key Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-account-history-api">Account History Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-block-api">Block Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-database-api">Database Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-debug-node-api">Debug Node Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-follow-api">Follow Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-jsonrpc">Jsonrpc</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-market-history-api">Market History Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-network-broadcast-api">Network Broadcast Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-rc-api">Rc Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-reputation-api">Reputation Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-rewards-api">Rewards Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-tags-api">Tags Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-transaction-status-api">Transaction Status Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-witness-api">Witness Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-broadcast-ops">Broadcast Ops</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-broadcast-ops-communities">Broadcast Ops Communities</a></li>
						
					
				
			
		</ul>
	</section>
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/resources/">
		<h6 class="ctrl-nav-section title">Resources</h6>
		<ul class="cont-nav-section content">
			
				
					
					
						
						<li><a href="/resources/#resources-overview">Overview</a></li>
						
					
						
						<li><a href="/resources/#resources-client-libs">Client Libraries</a></li>
						
					
						
						<li><a href="/resources/#resources-bluepaper">Bluepaper</a></li>
						
					
						
						<li><a href="/resources/#resources-whitepaper">Whitepaper</a></li>
						
					
						
						<li><a href="/resources/#resources-tools">Tools</a></li>
						
					
						
						<li><a href="/resources/#resources-hivesigner-libs">Hivesigner Libs</a></li>
						
					
						
						<li><a href="/resources/#resources-hive-keychain">Hive Keychain</a></li>
						
					
						
						<li><a href="/resources/#resources-developeradvocate">Community & Help</a></li>
						
					
				
			
		</ul>
	</section>
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/glossary/">
		<h6 class="ctrl-nav-section title">Glossary</h6>
		<ul class="cont-nav-section content">
			
				
					
					
						
						<li><a href="/glossary/#glossary-chain-basics">Chain Basics</a></li>
						
					
						
					
						
						<li><a href="/glossary/#glossary-governance">Governance</a></li>
						
					
						
						<li><a href="/glossary/#glossary-transactions">Transactions</a></li>
						
					
						
						<li><a href="/glossary/#glossary-api">API</a></li>
						
					
						
						<li><a href="/glossary/#glossary-market">Market</a></li>
						
					
				
			
		</ul>
	</section>
	
</div>



  <link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet">
</header>
<div class="main" id="top">
  <div class="hero">
    <h1 class="hero__h1">Hive Developer Portal </h1>
    <img class="hero__img" src="/images/honey-comb-92.png" style="position: relative; top: 10px;" />
  </div>
  <section id="tutorials-python-get-posts" class="row tutorials-python-get-posts">
	<h3>
		<a id="tutorials-python-get-posts">
			PY: Get Posts
			
		</a>
	</h3>
	
		<span class="description"><p>Tutorial pulls a list of the posts from the blockchain with selected filter and tag then displays output.</p>
</span>
	

	<p><span class="fa-pull-left top-of-tutorial-repo-link"><span class="first-word">Full</span>, runnable src of <a href="https://gitlab.syncad.com/hive/devportal/-/tree/master/tutorials/python/tutorials/04_get_posts">Get Posts</a> can be downloaded as part of: <a href="https://gitlab.syncad.com/hive/devportal/-/tree/master/tutorials/python">tutorials/python</a>.</span>
<br /></p>

<p>This tutorial will explain and show you how to access the <strong>Steem</strong> blockchain using the <a href="https://github.com/steemit/steem-python">steem-python</a> library to fetch list of posts filtered by a <em>filter</em> and <em>tag</em></p>

<h2 id="intro">Intro</h2>

<p>In Steem there are built-in filters <code class="highlighter-rouge">trending</code>, <code class="highlighter-rouge">hot</code>, <code class="highlighter-rouge">created</code>, <code class="highlighter-rouge">active</code>, <code class="highlighter-rouge">promoted</code> etc. which helps us to get list of posts. <code class="highlighter-rouge">get_discussions_by_trending(query)</code>, <code class="highlighter-rouge">get_discussions_by_hot(query)</code>, <code class="highlighter-rouge">get_discussions_by_created(query)</code>, etc. functions are built-in in official library <code class="highlighter-rouge">steem-python</code> that we are going to use throughout all Python tutorials.</p>

<h2 id="steps">Steps</h2>

<ol>
  <li><a href="#app-setup"><strong>App setup</strong></a> - Library install and import</li>
  <li><a href="#filters-list"><strong>Filters list</strong></a> - List of filters to select from</li>
  <li><a href="#query-details"><strong>Query details</strong></a> - Form a query</li>
  <li><a href="#print-output"><strong>Print output</strong></a> - Print results in output</li>
</ol>

<h4 id="1-app-setup-">1. App setup <a name="app-setup"></a></h4>

<p>In this tutorial we use 3 packages, <code class="highlighter-rouge">pick</code> - helps us to select filter interactively. <code class="highlighter-rouge">steem</code> - steem-python library, interaction with Blockchain. <code class="highlighter-rouge">pprint</code> - print results in better format.</p>

<p>First we import all three library and initialize Steem class</p>

<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code>    <span class="kn">import</span> <span class="nn">pprint</span>
    <span class="kn">from</span> <span class="nn">pick</span> <span class="kn">import</span> <span class="n">pick</span>
    <span class="c1"># initialize Steem class
</span>    <span class="kn">from</span> <span class="nn">steem</span> <span class="kn">import</span> <span class="n">Steem</span>

    <span class="n">s</span> <span class="o">=</span> <span class="n">Steem</span><span class="p">()</span>
</code></pre></div></div>

<h4 id="2-filters-list-">2. Filters list <a name="filters-list"></a></h4>

<p>Next we will make list of filters and setup <code class="highlighter-rouge">pick</code> properly.</p>

<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code>    <span class="n">title</span> <span class="o">=</span> <span class="s">'Please choose filter: '</span>
    <span class="c1">#filters list
</span>    <span class="n">options</span> <span class="o">=</span> <span class="p">[</span><span class="s">'trending'</span><span class="p">,</span> <span class="s">'hot'</span><span class="p">,</span> <span class="s">'active'</span><span class="p">,</span> <span class="s">'created'</span><span class="p">,</span> <span class="s">'promoted'</span><span class="p">]</span>
    <span class="c1"># get index and selected filter name
</span>    <span class="n">option</span><span class="p">,</span> <span class="n">index</span> <span class="o">=</span> <span class="n">pick</span><span class="p">(</span><span class="n">options</span><span class="p">,</span> <span class="n">title</span><span class="p">)</span>
</code></pre></div></div>

<p>This will show us list of filters to select in terminal/command prompt. And after selection we will get index and filter name to <code class="highlighter-rouge">index</code> and <code class="highlighter-rouge">option</code> variables.</p>

<h4 id="3-query-details-">3. Query details <a name="query-details"></a></h4>

<p>Next we will form a query. In Steem,</p>

<ul>
  <li>You can add a tag to filter the posts that you receive from the server</li>
  <li>You can also limit the amount of results you would like to receive from the query</li>
</ul>

<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">query</span> <span class="o">=</span> <span class="p">{</span>
    <span class="s">"limit"</span><span class="p">:</span><span class="mi">2</span><span class="p">,</span> <span class="c1">#number of posts
</span>    <span class="s">"tag"</span><span class="p">:</span><span class="s">""</span> <span class="c1">#tag of posts
</span>    <span class="p">}</span>
<span class="c1">#post list for selected query
</span><span class="n">posts</span> <span class="o">=</span> <span class="p">{</span><span class="mi">0</span><span class="p">:</span> <span class="n">s</span><span class="o">.</span><span class="n">get_discussions_by_trending</span><span class="p">(</span><span class="n">query</span><span class="p">),</span>
         <span class="mi">1</span><span class="p">:</span> <span class="n">s</span><span class="o">.</span><span class="n">get_discussions_by_hot</span><span class="p">(</span><span class="n">query</span><span class="p">),</span>
         <span class="mi">2</span><span class="p">:</span> <span class="n">s</span><span class="o">.</span><span class="n">get_discussions_by_active</span><span class="p">(</span><span class="n">query</span><span class="p">),</span>
         <span class="mi">3</span><span class="p">:</span> <span class="n">s</span><span class="o">.</span><span class="n">get_discussions_by_created</span><span class="p">(</span><span class="n">query</span><span class="p">),</span>
         <span class="mi">4</span><span class="p">:</span> <span class="n">s</span><span class="o">.</span><span class="n">get_discussions_by_promoted</span><span class="p">(</span><span class="n">query</span><span class="p">)</span>
<span class="p">}</span>
</code></pre></div></div>

<p>Above code shows example of query and simple list of function that will fetch post list with user selected filter.</p>

<h4 id="4-print-output-">4. Print output <a name="print-output"></a></h4>

<p>Next, we will print result, post list and selected filter name.</p>

<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code>    <span class="c1"># print post list for selected filter
</span>    <span class="n">pprint</span><span class="o">.</span><span class="n">pprint</span><span class="p">(</span><span class="n">posts</span><span class="p">[</span><span class="n">index</span><span class="p">])</span>
    <span class="n">pprint</span><span class="o">.</span><span class="n">pprint</span><span class="p">(</span><span class="s">"Selected: "</span><span class="o">+</span><span class="n">option</span><span class="p">)</span>
</code></pre></div></div>

<p>The example of result returned from the service is a <code class="highlighter-rouge">JSON</code> object with the following properties:</p>

<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">[</span><span class="w">
    </span><span class="p">{</span><span class="w">
        </span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="mi">37338948</span><span class="p">,</span><span class="w">
        </span><span class="nl">"author"</span><span class="p">:</span><span class="w"> </span><span class="s2">"steemitblog"</span><span class="p">,</span><span class="w">
        </span><span class="nl">"permlink"</span><span class="p">:</span><span class="w"> </span><span class="s2">"join-team-steemit-at-tokenfest"</span><span class="p">,</span><span class="w">
        </span><span class="nl">"category"</span><span class="p">:</span><span class="w"> </span><span class="s2">"steemit"</span><span class="p">,</span><span class="w">
        </span><span class="nl">"parent_author"</span><span class="p">:</span><span class="w"> </span><span class="s2">""</span><span class="p">,</span><span class="w">
        </span><span class="nl">"parent_permlink"</span><span class="p">:</span><span class="w"> </span><span class="s2">"steemit"</span><span class="p">,</span><span class="w">
        </span><span class="nl">"title"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Join Team Steemit at TokenFest!"</span><span class="p">,</span><span class="w">
        </span><span class="nl">"body"</span><span class="p">:</span><span class="w">
            </span><span class="s2">"&lt;a href=</span><span class="se">\"</span><span class="s2">https://tokenfest.adria.digital</span><span class="se">\"</span><span class="s2">&gt;&lt;img src=</span><span class="se">\"</span><span class="s2">https://i.imgur.com/fOScDIW.png</span><span class="se">\"</span><span class="s2">/&gt;&lt;/a&gt;</span><span class="se">\n\n</span><span class="s2">Hello Steemians! If you’d like to meet Team Steemit live-in-person, or are just interested in attending what promises to be a great blockchain conference, join us at &lt;a href=</span><span class="se">\"</span><span class="s2">https://tokenfest.adria.digital/</span><span class="se">\"</span><span class="s2">&gt;TokenFest&lt;/a&gt; in San Francisco from March 15th to 16th. </span><span class="se">\n\n</span><span class="s2">Steemit CEO, Ned Scott, will be participating in a fireside chat alongside Steemit’s CTO, Harry Schmidt, as well as the creator of Utopian.io, Diego Pucci. Steemit will also be hosting the opening party on Thursday night and we’d certainly love to meet as many of you as possible IRL, so head on over to https://tokenfest.adria.digital/ and get your tickets while you can. </span><span class="se">\n\n</span><span class="s2">*Team Steemit*"</span><span class="p">,</span><span class="w">
        </span><span class="nl">"json_metadata"</span><span class="p">:</span><span class="w">
            </span><span class="s2">"{</span><span class="se">\"</span><span class="s2">tags</span><span class="se">\"</span><span class="s2">:[</span><span class="se">\"</span><span class="s2">steemit</span><span class="se">\"</span><span class="s2">,</span><span class="se">\"</span><span class="s2">tokenfest</span><span class="se">\"</span><span class="s2">,</span><span class="se">\"</span><span class="s2">conference</span><span class="se">\"</span><span class="s2">],</span><span class="se">\"</span><span class="s2">image</span><span class="se">\"</span><span class="s2">:[</span><span class="se">\"</span><span class="s2">https://i.imgur.com/fOScDIW.png</span><span class="se">\"</span><span class="s2">],</span><span class="se">\"</span><span class="s2">links</span><span class="se">\"</span><span class="s2">:[</span><span class="se">\"</span><span class="s2">https://tokenfest.adria.digital</span><span class="se">\"</span><span class="s2">,</span><span class="se">\"</span><span class="s2">https://tokenfest.adria.digital/</span><span class="se">\"</span><span class="s2">],</span><span class="se">\"</span><span class="s2">app</span><span class="se">\"</span><span class="s2">:</span><span class="se">\"</span><span class="s2">steemit/0.1</span><span class="se">\"</span><span class="s2">,</span><span class="se">\"</span><span class="s2">format</span><span class="se">\"</span><span class="s2">:</span><span class="se">\"</span><span class="s2">markdown</span><span class="se">\"</span><span class="s2">}"</span><span class="p">,</span><span class="w">
        </span><span class="nl">"last_update"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2018-03-07T23:22:54"</span><span class="p">,</span><span class="w">
        </span><span class="nl">"created"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2018-03-07T20:56:36"</span><span class="p">,</span><span class="w">
        </span><span class="nl">"active"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2018-03-13T01:40:21"</span><span class="p">,</span><span class="w">
        </span><span class="nl">"last_payout"</span><span class="p">:</span><span class="w"> </span><span class="s2">"1970-01-01T00:00:00"</span><span class="p">,</span><span class="w">
        </span><span class="nl">"depth"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
        </span><span class="nl">"children"</span><span class="p">:</span><span class="w"> </span><span class="mi">29</span><span class="p">,</span><span class="w">
        </span><span class="nl">"net_rshares"</span><span class="p">:</span><span class="w"> </span><span class="s2">"11453442114933"</span><span class="p">,</span><span class="w">
        </span><span class="nl">"abs_rshares"</span><span class="p">:</span><span class="w"> </span><span class="s2">"11454054795840"</span><span class="p">,</span><span class="w">
        </span><span class="nl">"vote_rshares"</span><span class="p">:</span><span class="w"> </span><span class="s2">"11454054795840"</span><span class="p">,</span><span class="w">
        </span><span class="nl">"children_abs_rshares"</span><span class="p">:</span><span class="w"> </span><span class="s2">"13568695606090"</span><span class="p">,</span><span class="w">
        </span><span class="nl">"cashout_time"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2018-03-14T20:56:36"</span><span class="p">,</span><span class="w">
        </span><span class="nl">"max_cashout_time"</span><span class="p">:</span><span class="w"> </span><span class="s2">"1969-12-31T23:59:59"</span><span class="p">,</span><span class="w">
        </span><span class="nl">"total_vote_weight"</span><span class="p">:</span><span class="w"> </span><span class="mi">3462435</span><span class="p">,</span><span class="w">
        </span><span class="nl">"reward_weight"</span><span class="p">:</span><span class="w"> </span><span class="mi">10000</span><span class="p">,</span><span class="w">
        </span><span class="nl">"total_payout_value"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.000 SBD"</span><span class="p">,</span><span class="w">
        </span><span class="nl">"curator_payout_value"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.000 SBD"</span><span class="p">,</span><span class="w">
        </span><span class="nl">"author_rewards"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
        </span><span class="nl">"net_votes"</span><span class="p">:</span><span class="w"> </span><span class="mi">77</span><span class="p">,</span><span class="w">
        </span><span class="nl">"root_comment"</span><span class="p">:</span><span class="w"> </span><span class="mi">37338948</span><span class="p">,</span><span class="w">
        </span><span class="nl">"max_accepted_payout"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.000 SBD"</span><span class="p">,</span><span class="w">
        </span><span class="nl">"percent_steem_dollars"</span><span class="p">:</span><span class="w"> </span><span class="mi">10000</span><span class="p">,</span><span class="w">
        </span><span class="nl">"allow_replies"</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="p">,</span><span class="w">
        </span><span class="nl">"allow_votes"</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="p">,</span><span class="w">
        </span><span class="nl">"allow_curation_rewards"</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="p">,</span><span class="w">
        </span><span class="nl">"beneficiaries"</span><span class="p">:</span><span class="w"> </span><span class="p">[],</span><span class="w">
        </span><span class="nl">"url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"/steemit/@steemitblog/join-team-steemit-at-tokenfest"</span><span class="p">,</span><span class="w">
        </span><span class="nl">"root_title"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Join Team Steemit at TokenFest!"</span><span class="p">,</span><span class="w">
        </span><span class="nl">"pending_payout_value"</span><span class="p">:</span><span class="w"> </span><span class="s2">"46.436 SBD"</span><span class="p">,</span><span class="w">
        </span><span class="nl">"total_pending_payout_value"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.000 STEEM"</span><span class="p">,</span><span class="w">
        </span><span class="nl">"active_votes"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w">
            </span><span class="p">{</span><span class="w">
                </span><span class="nl">"voter"</span><span class="p">:</span><span class="w"> </span><span class="s2">"steemitblog"</span><span class="p">,</span><span class="w">
                </span><span class="nl">"weight"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
                </span><span class="nl">"rshares"</span><span class="p">:</span><span class="w"> </span><span class="s2">"1870813909383"</span><span class="p">,</span><span class="w">
                </span><span class="nl">"percent"</span><span class="p">:</span><span class="w"> </span><span class="mi">10000</span><span class="p">,</span><span class="w">
                </span><span class="nl">"reputation"</span><span class="p">:</span><span class="w"> </span><span class="s2">"128210130644387"</span><span class="p">,</span><span class="w">
                </span><span class="nl">"time"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2018-03-07T20:56:36"</span><span class="w">
            </span><span class="p">},</span><span class="w">
            </span><span class="p">{</span><span class="w">
                </span><span class="nl">"voter"</span><span class="p">:</span><span class="w"> </span><span class="s2">"kevinwong"</span><span class="p">,</span><span class="w">
                </span><span class="nl">"weight"</span><span class="p">:</span><span class="w"> </span><span class="mi">526653</span><span class="p">,</span><span class="w">
                </span><span class="nl">"rshares"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2208942520687"</span><span class="p">,</span><span class="w">
                </span><span class="nl">"percent"</span><span class="p">:</span><span class="w"> </span><span class="mi">5000</span><span class="p">,</span><span class="w">
                </span><span class="nl">"reputation"</span><span class="p">:</span><span class="w"> </span><span class="s2">"374133832002581"</span><span class="p">,</span><span class="w">
                </span><span class="nl">"time"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2018-03-08T04:27:00"</span><span class="w">
            </span><span class="p">}</span><span class="w">
        </span><span class="p">],</span><span class="w">
        </span><span class="nl">"replies"</span><span class="p">:</span><span class="w"> </span><span class="p">[],</span><span class="w">
        </span><span class="nl">"author_reputation"</span><span class="p">:</span><span class="w"> </span><span class="s2">"128210130644387"</span><span class="p">,</span><span class="w">
        </span><span class="nl">"promoted"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.000 SBD"</span><span class="p">,</span><span class="w">
        </span><span class="nl">"body_length"</span><span class="p">:</span><span class="w"> </span><span class="mi">754</span><span class="p">,</span><span class="w">
        </span><span class="nl">"reblogged_by"</span><span class="p">:</span><span class="w"> </span><span class="p">[]</span><span class="w">
    </span><span class="p">},</span><span class="w">
    </span><span class="p">{</span><span class="w">

    </span><span class="p">}</span><span class="w">
</span><span class="p">]</span><span class="w">
</span><span class="err">'Selected:</span><span class="w"> </span><span class="err">hot'</span><span class="w">
</span></code></pre></div></div>

<p>From this result you have access to everything associated to the posts including additional metadata which is a <code class="highlighter-rouge">JSON</code> string (that must be decoded to use), <code class="highlighter-rouge">active_votes</code> info, post title, body, etc. details that can be used in further development of application with Python.</p>

<p>That’s it!</p>

<h3 id="to-run-the-tutorial">To Run the tutorial</h3>

<ol>
  <li><a href="getting_started.html">review dev requirements</a></li>
  <li><code class="highlighter-rouge">git clone https://gitlab.syncad.com/hive/devportal.git</code></li>
  <li><code class="highlighter-rouge">cd devportal/tutorials/python/04_get_posts</code></li>
  <li><code class="highlighter-rouge">pip install -r requirements.txt</code></li>
  <li><code class="highlighter-rouge">python index.py</code></li>
  <li>After a few moments, you should see output in terminal/command prompt screen.</li>
</ol>

<hr />

</section>

</div>
<div class="footer">
  <a href="#">Back to top</a>
</div>
<script>
    document.getElementById("open-nav").addEventListener("click", function () {
        document.body.classList.toggle("nav-open");
    });
</script>
</body>
</html>


<script src="/js/adjust.js"></script>

